/*
 * Created: 2022-09-13 19:49:10
 * Author : 涛涛涛
 */

import React, { ComponentType, FC } from 'react';
import { View, Text, Input, InputProps } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import InputWrap from './InputWrap/InputWrap';
export interface IProps extends ICompProps {
    onChange?: (val: string) => void;
    ref: any;
}
const JYInput = React.forwardRef(function (props: IProps, inputRef: React.ForwardedRef<ComponentType<InputProps>>) {
    const { className, style, onChange } = props;
    const localClassName = useClassName('JYInput', className);
    return (
        <RootView className={localClassName} style={style}>
            <InputWrap isFocus={false}>
                <Input
                    ref={inputRef}
                    className="Input"
                    type="text"
                    onInput={(event) => {
                        onChange(event.detail.value);
                    }}
                />
            </InputWrap>
        </RootView>
    );
});
JYInput.defaultProps = {} as Partial<IProps>;

export default React.memo(JYInput as FC<IProps>);
const RootView = styled(View)`
    &.JYInput {
        .Input {
            font-size: 28px;
        }
    }
`;
